-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variance extractor #2543
Variance extractor #2543
Conversation
If I understand correctly, what you are basically doing here is computing an event-wise pedestal variance. In the data model (see the original top-level data model document), there are a few places you can put pedestals:
So I think what you are computing is the first one, and you should store it as pedestal information: It is in fact a second measurement of the pedestal and its variance, and could be compared to the other methods (even if the use case you are describing here is for doing star tracking, star tracking is computed from the pedestal variances, which can be over many time scales) |
In addition to what has been said I'd suggest to clarify the purpose of this extractor: it is calculating the waveform sample variance, which should be reflected in the name/docstring to communicate that it has a complicated relationship to charge. |
The thing we want to calculate is the variance of the waveforms specifically of interleaved pedestal events and not the variance of the pedestal in units of charge. @kosack : What we get is a sort of image based on the variance of the waveform in each pixel. What we get is not a pedestal value, so putting it in a pedestal container is not the best option i think. I think it is best to write a container appropriate for these variance images similar to the DL1CameraContainer |
That's not surprising, since you have just more samples. But you change of what you compute the variance |
Hi all, can we restart the discussion here? I made a small update to the extractor to contain timing information that will later be needed in the corresponding subclass of StatisticsExtractor that i am working on with Tjark. There was a decision needed as to where the variance images will be attached to. Should this find a place somewhere in dl1.event.telescope.pedestal or something similar? |
Hi @ctoennis the lint step in the CI is failing due to some typos and wrong formatting. To check locallly, make sure to install the pre-commit hooks: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
i fixed all the isses with the spelling, code checks etc. |
i can remove trigger time. But i am not sure how to proceed on the difference to the ImageExtractor API. I could make it that the variance image is stored in a DL1ImageContainer and that it complies with the API or make it a separate class that doesn't inherit from the ImageExtractor. I think what i generate here is a type of image as i try to look for stars in the camera FOV with them. But if it makes more sense to you it can be separate from the ImageExtractors. |
The question is if it is possible to adhere to the API that is expected from the image extractors: if yes, no problem, let it be an image extractor. But that means for example the call above should work and correctly write out the data to the HDF5 file. If you need the different API, it should be its own thing and we need to think about how to integrate it into the process tool for example. |
I think what this class does is not the same as an The idea of the ImageExtractors was that low-level routines like those used to compute peak time or integral are implemeted as basic functions taking numpy inpus, and the ImageExtractor composes several of those methods into one set of algorithms. So what I would expect here is more like a function to compute the variance, and then that function is added to one or more of the existing ImageExtractors, perhaps as an option. So that then the chosen ImageExtractor generates the required peak time and integral, but also the variance |
You could think of this as an |
I believe, it is an ImageExtractor, the
Only The only issue, that has to be resolved, is the return type. I'd propose to add an intermediate container: class CameraImageContainer(Container):
"""
Storage of output of generic camera images (any reduction of waveforms).
"""
image = Field(
None,
"Numpy array of camera image, after waveform extraction."
"Shape: (n_pixel) if n_channels is 1 or data is gain selected"
"else: (n_channels, n_pixel)",
)
class DL1CameraContainer(CameraImageContainer):
"""
Storage of output of camera calibration e.g the final calibrated
image in intensity units and the pulse time.
"""
peak_time = Field(
None,
"Numpy array containing position of the peak of the pulse as determined by "
"the extractor."
"Shape: (n_pixel) if n_channels is 1 or data is gain selected"
"else: (n_channels, n_pixel)",
)
# rest of the DL1CameraContainer fields
class VarianceContainer(CameraImageContainer):
"""
Storage of output of camera variance image.
Stores the variance of waveform in each pixel, composed as an image.
"""
variance_method = Field(
VarianceType.SIMPLE,
"Method by which the variance was calculated"
"This can either be a plain variance"
"or a variance of integrated samples",
type=VarianceType,
)
# I don't think you need anything else here. The trigger time you extract from elsewhere in the event tree. and change the return type of base |
If it's just that the Adding an additional field to the I would avoid having extractors that have different return types. |
9e698ac
to
6f0f347
Compare
This comment has been minimized.
This comment has been minimized.
So, is this request then good to merge? |
I'll take a look tomorrow or today hopefully! Might take a bit of time since there are a lot of changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. but I would like to have a test that checks for correctness. It is a simple algorithm, but the test will also ensure that nobody breaks it in the future. E.g. a test that runs the extractor on some dummy data with a known variance.
i added a test to check that an actual variance is being calculated. |
Analysis Details0 IssuesCoverage and DuplicationsProject ID: cta-observatory_ctapipe_AY52EYhuvuGcMFidNyUs |
This pull request is to add a new ImageExtractor subclass to generate images from the variance of waveforms that will be needed for the pointing calibration using stars. This request is related to issue #2542 .